#ifndef _MFG_H
#define _MFG_H

//#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "ZDApp.h"
#include "ZDProfile.h"
#include "ZDObject.h"
#include "ZDSecMgr.h"
#include "bdb_interface.h"

/* MACRO */


#define  MFG_CSState    uint32

#define  MFG_malloc        osal_mem_alloc
#define  MFG_free          osal_mem_free
#define  MFG_setEvent      osal_set_event
#define  MFG_startTimer    osal_start_timerEx

#define  MFG_LOAD_U16(p,w)   (*p=LO_UINT16(w),*(p+1)=HI_UINT16(w))
#define  MFG_SelfTaskId()    osal_self()

#define  MFG_MAC_OR( mac )    (mac[0]|mac[1]|mac[2]|mac[3]|mac[4]|mac[5]|mac[6]|mac[7])
#define  MFG_MAC_AND( mac )   (mac[0]&mac[1]&mac[2]&mac[3]&mac[4]&mac[5]&mac[6]&mac[7])
#define  MFG_MAC_ZERO( mac )  (MFG_MAC_OR(mac) == 0)
#define  MFG_MAC_FF( mac )    (MFG_MAC_AND(mac) == 0xFF)
//MFG events
//#define  MFG_MSG_IN_EVENT    0x4000
#define  MFG_CMD_RX_EVENT                  0x2000
#define  MFG_CMD_TX_EVENT                  0x1000
// Green Power Events
#define  MFG_GP_TEMP_MASTER_EVT            0x0800
#define  MFG_GP_EXPIRE_DUPLICATE_EVT       0x0400
#define  MFG_GP_DATA_SEND_EVT              0x0200
// Coord event
#define  MFG_PERIOD_EVENT                  0x0002  //every second
#define  MFG_INIT_EVENT                    0x0001



/* MACRO */


/* TYPEDEF*/
//typedef uint8   uint8_t;
//typedef uint16  uint16_t;
//typedef uint32  uint32_t;
//typedef int8    int8_t;
//typedef int16   int16_t;
//typedef int32   int32_t;

typedef uint8 mfgDevSn_t[9];
typedef uint8 mfgDevAddr_t[3];

#endif
